home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 May / Disc 2 / PCU0503CD2.iso / Crystal / 3rdparty / JavaVM / Plug-in / jplugin.exe / rt.jar / sun / awt / windows / WFontPeer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-16  |  2.0 KB  |  68 lines

  1. package sun.awt.windows;
  2.  
  3. import sun.awt.PlatformFont;
  4. import sun.io.CharToByteConverter;
  5.  
  6. public class WFontPeer extends PlatformFont {
  7.    private String wfsname;
  8.  
  9.    public WFontPeer(String var1, int var2) {
  10.       super(var1, var2);
  11.       if (super.props != null) {
  12.          this.wfsname = super.props.getProperty("fontset." + super.aliasName + "." + super.styleString);
  13.       }
  14.  
  15.    }
  16.  
  17.    public CharToByteConverter getFontCharset(String var1, String var2) {
  18.       CharToByteConverter var3;
  19.       if (var1.equals("default")) {
  20.          var3 = (CharToByteConverter)PlatformFont.charsetRegistry.get(var2);
  21.       } else {
  22.          var3 = (CharToByteConverter)PlatformFont.charsetRegistry.get(var1);
  23.       }
  24.  
  25.       if (var3 instanceof CharToByteConverter) {
  26.          return var3;
  27.       } else {
  28.          Class var4 = null;
  29.  
  30.          try {
  31.             var4 = Class.forName(var1);
  32.          } catch (ClassNotFoundException var9) {
  33.             try {
  34.                var4 = Class.forName("sun.io." + var1);
  35.             } catch (ClassNotFoundException var8) {
  36.                try {
  37.                   var4 = Class.forName("sun.awt.windows." + var1);
  38.                } catch (ClassNotFoundException var7) {
  39.                   var3 = this.getDefaultFontCharset(var2);
  40.                }
  41.             }
  42.          }
  43.  
  44.          if (var3 == null) {
  45.             try {
  46.                var3 = (CharToByteConverter)var4.newInstance();
  47.             } catch (InstantiationException var5) {
  48.                return this.getDefaultFontCharset(var2);
  49.             } catch (IllegalAccessException var6) {
  50.                return this.getDefaultFontCharset(var2);
  51.             }
  52.          }
  53.  
  54.          if (var1.equals("default")) {
  55.             PlatformFont.charsetRegistry.put(var2, var3);
  56.          } else {
  57.             PlatformFont.charsetRegistry.put(var1, var3);
  58.          }
  59.  
  60.          return var3;
  61.       }
  62.    }
  63.  
  64.    private CharToByteConverter getDefaultFontCharset(String var1) {
  65.       return new WDefaultFontCharset(var1);
  66.    }
  67. }
  68.